package cn.itcast.bos.web.action.base;

import cn.itcast.bos.domain.base.Courier;
import cn.itcast.bos.service.base.CourierService;
import cn.itcast.bos.web.action.commen.BaseAction;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.ModelDriven;
import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

@Controller
@Namespace("/")
@ParentPackage("struts-default")
@Scope("prototype")
public class CourierAction extends BaseAction<Courier>{
    @Autowired
    private CourierService courierService;
    private String ids;
    public void setIds(String ids) {
        this.ids = ids;
    }

    @Action(value = "courier_save",results = {@Result(name = "success",type = "redirect",location = "./pages/base/courier.html")})
    public String save(){
        courierService.save(model);
        return SUCCESS;
    }
    @Action(value = "courier_delBatch",results = {@Result(name = "success",type = "redirect",location = "./pages/base/courier.html")})
    public String delBatch(){
        String []idsArray=ids.split("\\.");
        courierService.delBatch(idsArray);
        return SUCCESS;
    }
    @Action(value = "courier_restore",results = {@Result(name = "success",type = "redirect",location = "./pages/base/courier.html")})
    public String restore(){
        String []idsArray=ids.split("\\.");
        courierService.restore(idsArray);
        return SUCCESS;
    }


}
